package model;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum MessageType
{
	UNDEFINED(0,"undefined"),
	SYSTEM (1,"System"),
	CUSTOM(2, "Custom"),
	APPLICATION(3,"Message"),
	COMPLAINT(4,"Complaint"),
	UNSOLVEDTASK(5,"Unsolved task"),
	EMPTYWAITINGLIST(6,"Empty waiting list");
	
	/* FIELDS */
	private final int index;
	private final String value;
	private static final Map<Integer,MessageType> lookup = new HashMap<Integer,MessageType>();
	
	/* CONSTRUCTORS */
	private MessageType(int index, String value) 
	{
        this.index = index;
        this.value = value;
    }
	static 
	{
	    for(MessageType ct : EnumSet.allOf(MessageType.class))
	         lookup.put(ct.getIndex(), ct);
	}
	/* ACCESSORS */
	public int getIndex()
	{
		return this.index;
	}
	public String getValue()
	{
		return this.value;
	}
	public static MessageType getType(int index) { 
        return lookup.get(index); 
   }

}